package com.thinkfit.jy.serialport;

public class CRC8 {
    static {
        System.loadLibrary("crc8");
    }
    private native static byte getCRC8(byte data[],int len);

    public static byte getCRC8Result(byte data[],int len)
    {
        return getCRC8(data,len - 1);
    }

    public static boolean isCRC8Correct(byte data[],int len)
    {
        if(data[len - 1] == getCRC8(data,len - 1))
            return true;
        return false;
    }
}